//
//  OrderDetailViewCell.m
//  EastMarket
//
//  Created by 李鹏程 on 16/11/2.
//  Copyright © 2016年 guoguo. All rights reserved.
//

#import "OrderDetailViewCell.h"

@implementation OrderDetailViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    
    if (self == [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        CGFloat spacing = 8.0f;
        CGFloat border = 1.0f;
//        CGFloat lblHeight = 22.0f;
        
        // 产品icon
        _imgProductIcon = [[UIImageView alloc] initWithFrame:CGRectMake(spacing, spacing, 80 - 2 * spacing, 80 - 2 * spacing)];
        _imgProductIcon.backgroundColor = [UIColor clearColor];
        [self.contentView addSubview:_imgProductIcon];
        
        // 产品名称
        _lblProductName = [[UILabel alloc] init];
        _lblProductName.frame = CGRectMake(_imgProductIcon.frame.origin.x + spacing + _imgProductIcon.frame.size.width, spacing, SCREEN_WIDTH - _imgProductIcon.frame.origin.x - _imgProductIcon.frame.size.width - 2 * spacing, (80 - 2 * spacing) / 2);
        _lblProductName.textColor = EastMarket_darkBlackFontColor;
        _lblProductName.font = [UIFont boldSystemFontOfSize:16];
        _lblProductName.numberOfLines = 0;
        [self.contentView addSubview:_lblProductName];
        
        _lblProductPrice = [[UILabel alloc] init];
        _lblProductPrice.frame = CGRectMake(_lblProductName.frame.origin.x, _lblProductName.frame.origin.y + _lblProductName.frame.size.height, (SCREEN_WIDTH - _imgProductIcon.frame.origin.x - _imgProductIcon.frame.size.width - 3 * spacing - border) * 2 / 3, _lblProductName.frame.size.height);
        _lblProductPrice.textColor = EastMarket_MainToneColor;
        [_lblProductPrice setFont:[UIFont systemFontOfSize:14]];
        [self.contentView addSubview:_lblProductPrice];
        
        _lblProductNum = [[UILabel alloc] initWithFrame:CGRectMake(_lblProductPrice.frame.origin.x + _lblProductPrice.frame.size.width + border, _lblProductPrice.frame.origin.y, (SCREEN_WIDTH - _imgProductIcon.frame.origin.x - _imgProductIcon.frame.size.width - 3 * spacing - border) / 3, _lblProductName.frame.size.height)];
        _lblProductNum.textColor = EastMarket_darkGreyFontColor;
        _lblProductNum.textAlignment = NSTextAlignmentCenter;
        _lblProductNum.font = [UIFont systemFontOfSize:16];
        [self.contentView addSubview:_lblProductNum];

//        UIView *viewSpacing = [[UIView alloc] initWithFrame:CGRectMake(_btnNumReduce.frame.origin.x,_lblProductNum.frame.origin.y + _lblProductNum.frame.size.height + spacing, SCREEN_WIDTH, 1)];
//        [self addSubview:viewSpacing];
//        viewSpacing.backgroundColor = EastMarket_bordColor;
    }
    
    return self;
}

@end
